//
//  Zone.m
//  OC07_MRC省市区
//
//  Created by Hanlingyu on 16/7/12.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "Zone.h"

@implementation Zone
@synthesize name = _name;

- (void)setName:(NSString *)name {
    if (_name != name) {
        [_name release];
        _name = [name retain];
    }
}
- (NSString *)name {
    return [[_name retain]autorelease];
}

- (instancetype)initWithName:(NSString *)name {
    if (self) {
        _name = [name retain];
    }
    return self;
}

+ (instancetype)zoneWithName:(NSString *)name {
    Zone *zone = [[Zone alloc] initWithName:name number:nil];
    return [zone autorelease];
}
- (void)dealloc {
    [_name release];
    [super dealloc];

}
- (NSString *)description {
    return [NSString stringWithFormat:@"%@, %@", _name, _number];
}
- (instancetype)initWithName:(NSString *)name number:(NSString *)number {
    self = [super init];
    if (self) {
        _name = name;
        _number = number;
    }
    return self;
}

+ (instancetype)zoneWithName:(NSString *)name number:(NSString *)number {
    return [[[Zone alloc] initWithName:name number:number] autorelease];
}

- (instancetype)initWithTempCity:(TempCity *)tempCity {
    return [[self initWithName:tempCity.cityName number:tempCity.cityNumber] autorelease];
}

+ (instancetype)zoneWithTempCity:(TempCity *)tempCity {
    return [[self alloc] initWithTempCity:tempCity];
}


@end
